package actionHandlers;

import javax.swing.JInternalFrame;
import javax.swing.event.InternalFrameEvent;
import javax.swing.event.InternalFrameListener;
import palette.CanvasManager;
import palette.DrawingWindow;


public class SelectedCanvasListener implements InternalFrameListener{

	@Override
	public void internalFrameActivated(InternalFrameEvent e) {
		// Uncomment the next line to see when this event is being handled.
		//System.out.println("internalFrameActivated event occurred");
		JInternalFrame window = CanvasManager.getInst().getSelectedFrame();
		if(window instanceof palette.DrawingWindow ){
			((DrawingWindow) (CanvasManager.getInst().getSelectedFrame())).getShapeExplorer().setShapeTree(((DrawingWindow) (CanvasManager.getInst().getSelectedFrame())).getShapeTree());
			((DrawingWindow) (CanvasManager.getInst().getSelectedFrame())).getShapeProperties().setShapeTable(((DrawingWindow) (CanvasManager.getInst().getSelectedFrame())).getShapeTable());

		}
		
	}

	@Override
	public void internalFrameClosed(InternalFrameEvent e) {
		System.out.println("here");
		// TODO Auto-generated method stub
		
	}

	@Override
	public void internalFrameClosing(InternalFrameEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void internalFrameDeactivated(InternalFrameEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void internalFrameDeiconified(InternalFrameEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void internalFrameIconified(InternalFrameEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void internalFrameOpened(InternalFrameEvent e) {
		// TODO Auto-generated method stub
		
	}


}
